// 接口















import request from 'umi-request';
console.log(request);
// token:  // 所有请求默认带上 token 参数
export const getTabledata = ()=> {
  return request('/api/user', {
    method: 'get',
    params: {},
  })
    .then(function(response) {
      console.log(response.data);

      return response.data
    })
    .catch(function(error) {
      console.log(error);
    });
  
}


export const delTabledata = (data)=> {
  return request('/api/userinfo/deleteInfo', {
    method: 'post',
    data,
    headers:{
      token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2Mzk4MDk1ODAsInVzZXJuYW1lIjoiYWRtaW4ifQ.r0lQpSY-SgHWiKd7TB0ABL7U3IxhNv1NfvbadI7cn5Q"
    }
  })
    .then(function(response) {
      console.log(response.data);
      
      return response.data
    })
    .catch(function(error) {
      console.log(error);
    });
  
}

export const AddUser = (data)=> {
  return request('/api/userinfo/addInfo', {
    method: 'post',
    data,
    headers:{
      token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2Mzk4MDk1ODAsInVzZXJuYW1lIjoiYWRtaW4ifQ.r0lQpSY-SgHWiKd7TB0ABL7U3IxhNv1NfvbadI7cn5Q"
    }
  })
    .then(function(response) {
      console.log(response);
      
      return response
    })
    .catch(function(error) {
      console.log(error);
    });
  
}
export const EditUser = (data)=> {
  return request('/api/userinfo/updateInfo', {
    method: 'post',
    data,
    headers:{
      token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2Mzk4MDk1ODAsInVzZXJuYW1lIjoiYWRtaW4ifQ.r0lQpSY-SgHWiKd7TB0ABL7U3IxhNv1NfvbadI7cn5Q"
    }
  })
    .then(function(response) {
      console.log(response);

      return response
    })
    .catch(function(error) {
      console.log(error);
    });
  
}